package com.tt;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class Product {
    public int price;
    Lock lock = new ReentrantLock();

    public Product(int price) {
        this.price = price;
    }

    public void addPrice(int value) {
        lock.lock();
        try {
            this.price = this.price + value;
        } finally {
            lock.unlock();
        }
    }
}
